package com.lww.feature.test.io.pipe.nobuffer;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.PipedOutputStream;

/**
 * @author yi an
 * @date 2017/3/23
 */
public class Producer extends Thread {

    private PipedOutputStream pos;

    public Producer(PipedOutputStream pos) {
        this.pos = pos;
    }

    public void run() {
        int i = 10000000;
        try {
            while(true)
            {
                System.out.println("write:"+i);
                pos.write(i);
                i++;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
